//
//  CEGoldHeaderView.m
//  digitalCurrency
//
//  Created by 来迎宾 on 2019/4/4.
//  Copyright © 2019年 XinHuoKeJi. All rights reserved.
//

#import "CEGoldHeaderView.h"

@implementation CEGoldHeaderView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor blackColor];
        [self createviews];
    }
    return self;
}

- (void)createviews {
    CGFloat viewwidth = SCREEN_WIDTH;
    UIView *topview = [[UIView alloc] init];
    topview.backgroundColor = [UIColor blackColor];
    topview.layer.cornerRadius = 8;
    [self addSubview:topview];
    [topview mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.top.mas_equalTo(10);
        make.width.mas_equalTo(viewwidth-30);
        make.height.mas_equalTo(110);
    }];
    
    UIImageView *imgview = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"home_jiangjinchi"]];
    [topview addSubview:imgview];
    [imgview mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.top.mas_equalTo(0);
        make.width.mas_equalTo(topview);
        make.height.mas_equalTo(topview);
    }];
    
    UILabel *title  = [[UILabel alloc] init];
    title.textColor = [UIColor whiteColor];
    title.text = LocalizationKey(@"Bonus pool this week");
    title.font = [UIFont boldSystemFontOfSize:14];
    [topview addSubview:title];
    [title mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(22);
        make.top.mas_equalTo(30);
        make.width.mas_equalTo(viewwidth/2.0);
        make.height.mas_equalTo(20);
    }];
    
    UILabel *allcountLabel  = [[UILabel alloc] init];
    allcountLabel.textColor = [UIColor whiteColor];
    allcountLabel.text = @"900 CE";
    allcountLabel.font = [UIFont boldSystemFontOfSize:22];
    [topview addSubview:allcountLabel];
    self.allcountLabel = allcountLabel;
    [allcountLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(22);
        make.top.mas_equalTo(60);
        make.width.mas_equalTo(viewwidth-60);
        make.height.mas_equalTo(40);
    }];
    
    UIView *midview = [[UIView alloc] init];
    midview.backgroundColor = [UIColor blackColor];
    midview.layer.cornerRadius = 8;
    [self addSubview:midview];
    [midview mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.top.mas_equalTo(135);
        make.width.mas_equalTo(viewwidth-30);
        make.height.mas_equalTo(110);
    }];
    UIImageView *imgview1 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"home_guanjun"]];
    [midview addSubview:imgview1];
    [imgview1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.top.mas_equalTo(0);
        make.width.mas_equalTo(topview);
        make.height.mas_equalTo(topview);
    }];
    
    UILabel *weakl = [[UILabel alloc] init];
    weakl.text = LocalizationKey(@"Last week champion:");
    weakl.textColor = [UIColor whiteColor];
    weakl.font = [UIFont systemFontOfSize:14];
    [midview addSubview:weakl];
    self.lastweakLabel = weakl;
    [weakl mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(22);
        make.top.mas_equalTo(30);
        make.width.mas_equalTo(viewwidth-120);
        make.height.mas_equalTo(20);
    }];
    
    UILabel *goldLabel = [[UILabel alloc] init];
    goldLabel.text = LocalizationKey(@"Champion bonus");
    goldLabel.textColor = [UIColor whiteColor];
    goldLabel.font = [UIFont systemFontOfSize:14];
    [midview addSubview:goldLabel];
    self.goldcoinLabel = goldLabel;
    [goldLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(22);
        make.top.mas_equalTo(62);
        make.width.mas_equalTo(viewwidth-120);
        make.height.mas_equalTo(20);
    }];
    
//    UILabel *mybangLabel = [[UILabel alloc] init];
//    mybangLabel.text = LocalizationKey(@"My ranking");
//    mybangLabel.textColor = [UIColor whiteColor];
//    mybangLabel.font = [UIFont systemFontOfSize:14];
//    [self addSubview:mybangLabel];
//    self.mybangLabel = mybangLabel;
//    [mybangLabel mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.left.mas_equalTo(15);
//        make.top.mas_equalTo(260);
//        make.width.mas_equalTo(viewwidth-120);
//        make.height.mas_equalTo(20);
//    }];
//    
//    UIButton *ruleBtn = [UIButton buttonWithType:UIButtonTypeCustom];
//    [ruleBtn setTitle:[NSString stringWithFormat:@"%@ >",LocalizationKey(@"Reward rules")] forState:UIControlStateNormal];
//    [ruleBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
//    ruleBtn.titleLabel.font = [UIFont systemFontOfSize:14];
//    [self addSubview:ruleBtn];
//    self.ruleBtn = ruleBtn;
//    [ruleBtn mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.right.mas_equalTo(0);
//        make.top.mas_equalTo(260);
//        make.width.mas_equalTo(100);
//        make.height.mas_equalTo(20);
//    }];
//    
//    UIView *line = [[UIView alloc] init];
//    [self addSubview:line];
//    line.backgroundColor = [UIColor whiteColor];
//    [line mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.right.mas_equalTo(-15);
//        make.top.mas_equalTo(290);
//        make.left.mas_equalTo(15);
//        make.height.mas_equalTo(1);
//    }];
}


@end
